#include "label.h"
#include<QMouseEvent>
#include<QDebug>
Label::Label(QWidget *parent)
    : QLabel{parent}
{}

void Label::mousePressEvent(QMouseEvent *event)
{
    if(event->button()==Qt::LeftButton)
    {
        qDebug()<<"mousePressEvent左键按下";
    }
}

bool Label::event(QEvent *event)
{
    if(event->type()==QEvent::MouseButtonPress||event->type()==QEvent::MouseButtonDblClick)
    {
        qDebug()<<"event左键按下";
        return true;//表示拦截
    }
    return QWidget::event(event);//向下派发
}
